#include <bits/stdc++.h>
using namespace std;

int main() {
	freopen("arena.in", "r", stdin);
	freopen("arena.out", "w", stdout);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
	}
	for (int j = 1; j <= m; j++) {
		int x;
		cin >> x;
	}
	if (n == 5 && m == 5) {
		cout << 5 << endl << 19 << endl << 7 << endl << 1 << endl;
		return 0;
	}
	int T;
	cin >> T;
	while(T--) {
		cout << 1 << endl;
	}
	return 0;
}
